using UnityEngine;
using System.Collections;

public class Selections : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	
	
	
	// Update is called once per frame
	void Update () {
		checkMouse();
	}
	
	void getMouseCollisionPoint(){
		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		RaycastHit hit;
		if(Physics.Raycast(ray, out hit,100)){
			Debug.DrawLine(ray.origin, hit.point);
			
			// FLATTEN VERTEX TEST
			//GetComponent<FlattenVertexCircle>().flattenVertexes(hit.point, 10);
			//GameObject bob = GameObject.Find("TestMarker");
			//bob.transform.position = GetComponent<FlattenVertexCircle>().flattenVertexes(hit.point, 3);
			
			// RE-PATH ALL ENEMIES TEST
			//GameObject bob = GameObject.Find("PathCalculator");
			//bob.GetComponent<AstarAI>().startNewPath(hit.point);
			//GetComponent<EnemyControler>().getNewPath();
			
			GetComponent<TurretManager>().addTurretHere(hit.point,"Default");
		}
	}
	
	void checkMouse(){
		if(Input.GetMouseButtonDown(0)){
		    //print("hello");
			
			getMouseCollisionPoint();
			
		}
	}
	
}
